package com.test.mooan.labama.bean_boom.user_info_boom;

import android.graphics.Bitmap;

import com.google.gson.Gson;
import com.test.mooan.labama.utils_boom.Stringutil_boom;

import org.json.JSONArray;
import org.json.JSONException;

import java.util.ArrayList;


public class ActList_boom {

    private static class Inner {
        private static final ActList_boom instance = new ActList_boom();
    }

    private ActList_boom() {}

    public static ActList_boom getInstance() {
        return Inner.instance;
    }

    private final ArrayList<BankAccount> bankAccountList = new ArrayList<>();

    public static void parse(JSONArray jsonArray) {
        Gson gson = new Gson();
        Inner.instance.bankAccountList.clear();
        for (int i=0;i<jsonArray.length();i++){
            try {
                BankAccount bankAccount = gson.fromJson(jsonArray.get(i).toString(), BankAccount.class );
                Inner.instance.bankAccountList.add(bankAccount);
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }

    }

    public ArrayList<BankAccount> gBankAccountList() {
        return bankAccountList;
    }

    public static class BankAccount {

        private String id;
        private String walletMobile;
        private String walletLogo;
        private String walletDesc;

        private Bitmap bitmap;

        public String gId() {
            return Stringutil_boom.getSafeString(id);
        }

        public String gWalletMobile() {
            return Stringutil_boom.getSafeString(walletMobile);
        }

        public String gWalletLogo() {
            return Stringutil_boom.getSafeString(walletLogo);
        }

        public void sBitmap(Bitmap bitmap) {
            this.bitmap = bitmap;
        }

        public Bitmap gBitmap() {
            return bitmap;
        }

        public String gWalletDesc() {
            return Stringutil_boom.getSafeString(walletDesc);
        }
    }

}
